package club.bigtian.statusbar;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.StatusBarWidget;
import com.intellij.openapi.wm.StatusBarWidgetFactory;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

/**
 * 状态栏组件工厂
 */
public class StatusBarTextWidgetFactory implements StatusBarWidgetFactory {
    
    private static final String FACTORY_ID = "StatusBarTextWidgetFactory";
    
    @Override
    public @NonNls @NotNull String getId() {
        return FACTORY_ID;
    }
    
    @Override
    public @Nls @NotNull String getDisplayName() {
        return "状态栏文字显示";
    }
    
    @Override
    public boolean isAvailable(@NotNull Project project) {
        // 返回true表示该组件对所有项目可用
        return true;
    }
    
    @Override
    public @NotNull StatusBarWidget createWidget(@NotNull Project project) {
        return new StatusBarTextWidget(project);
    }
    
    @Override
    public void disposeWidget(@NotNull StatusBarWidget widget) {
        // 清理widget资源
    }
    
    @Override
    public boolean canBeEnabledOn(@NotNull StatusBar statusBar) {
        // 返回true表示可以在状态栏上启用
        return true;
    }
}

